package com.fxcalibre.db.beans;

import java.util.List;

import com.fxcalibre.hibernate.GenericCriteria;
import com.fxcalibre.hibernate.HibernateUtils;

public abstract class HibernateBean
{
    public static GenericCriteria crearCriterio()
    {
	return null;
    }

    public static HibernateBean buscarPorId(String entidad, int beanId)
    {
	return (HibernateBean) HibernateUtils.buscarPorId(entidad, beanId);
    }

    public static List<?> buscar()
    {
	return HibernateUtils.buscar(crearCriterio());
    }
    
    public static List<?> buscar(GenericCriteria criterio)
    {
	return HibernateUtils.buscar(criterio);
    }

    public static List<?> buscar(GenericCriteria criterio, int maxResults)
    {
	return HibernateUtils.buscar(criterio, maxResults);
    }
    
    public abstract void initialize();
    
    public int grabar()
    {
	return HibernateUtils.grabar(this);
    }

    public boolean borrar()
    {
	return HibernateUtils.borrar(this);
    }
}